import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import iview from 'iview';
import 'iview/dist/styles/iview.css';
import api from '@/api';
import jquery from 'jquery';
import moment from 'moment';
// import '@s/plugins/kindeditor/kindeditor-all.js';
import jsplubmplugin from '@c/vue-jsplumb';

// import VueQuillEditor from 'vue-quill-editor';
// import 'quill/dist/quill.core.css';
// import 'quill/dist/quill.snow.css';
// import 'quill/dist/quill.bubble.css';
import '../static/plugins/kindeditor/kindeditor-all.js';
import VueMaterial from 'vue-material';
import 'vue-material/dist/vue-material.min.css';
import 'vue-material/dist/theme/default.css'; // This line here
Vue.use(VueMaterial);

// Vue.use(VueQuillEditor);
// import Vue from 'vue'
// import VueHtml5Editor from 'vue-html5-editor';
window.$ = jquery;
window.jquery = jquery;
window.jQuery = jquery;

Vue.use(iview, {
  transfer: true,
  size: 'small'
});
Vue.use(api);
Vue.use(jsplubmplugin);
Vue.config.productionTip = false;

// 日期过滤器
Vue.filter('dateFormat', function (value) {
  let timeobj = moment(value);
  if (timeobj.isValid()) {
    return timeobj.format('YYYY/MM/DD');
  } else {
    return '';
  }
});
// 时间过滤器
Vue.filter('timeFormat', function (value) {
  let timeobj = moment(value);
  if (timeobj.isValid()) {
    return timeobj.format('YYYY/MM/DD hh:mm');
  } else {
    return '';
  }
});

/**
 * 截取字符串
 */
Vue.filter('textIntercept', function (value, length) {
  if ((typeof value === 'string') && value.constructor === String) {
    return value.substr(0, length) + '...';
  } else {
    return value.toString().substr(0, length) + '...';
  }
});
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app');
